home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 4.4 KB | 164 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: ButtonSel.cpp
- // Release Version: $ 1.0d11 $
- //
- // Author: M.Boetcher
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef BUTTONSEL_H
- #include "ButtonSel.h"
- #endif
-
- #ifndef BUTTONPART_H
- #include "ButtonPart.h"
- #endif
-
- #ifndef BUTTONDEF_H
- #include "ButtonDef.h"
- #endif
-
- #ifndef ACTIONS_H
- #include "Actions.h"
- #endif
-
- // ----- Framework Includes -----
-
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWBARRAY_H
- #include "FWBArray.h"
- #endif
-
- #ifndef FWMEMMGR_H
- #include "FWMemMgr.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- // ----- Macintosh Includes -----
-
- #if defined(FW_BUILD_MAC) && !defined(__DRAG__)
- #include <Drag.h>
- #endif
-
- //========================================================================================
- // Runtime information
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment ButtonPart
- #endif
-
- //========================================================================================
- // CLASS CButtonSelection
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CButtonSelection constructor
- //----------------------------------------------------------------------------------------
-
- CButtonSelection::CButtonSelection(Environment* ev,
- CButtonPart* buttonPart) :
- FW_CSelection(ev, FALSE, FALSE),
- fButtonPart(buttonPart)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonSelection destructor
- //----------------------------------------------------------------------------------------
-
- CButtonSelection::~CButtonSelection()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonSelection::CloseSelection
- //----------------------------------------------------------------------------------------
-
- void CButtonSelection::CloseSelection(Environment* ev)
- {
- // Nothing to do
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonSelection::ClearSelection
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CButtonSelection::ClearSelection(Environment* ev)
- {
- return FALSE; // Do nothing
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonSelection::IsEmpty
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CButtonSelection::IsEmpty(Environment* ev) const
- {
- return (fButtonPart->GetAction() == NULL);
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonSelection::SelectAll
- //----------------------------------------------------------------------------------------
-
- void CButtonSelection::SelectAll(Environment* ev)
- {
- // Nothing to do
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonSelection::DoExternalizeSelection
- //----------------------------------------------------------------------------------------
-
- void CButtonSelection::DoExternalizeSelection(
- Environment* ev,
- ODStorageUnit* storage,
- FW_CCloneInfo* cloneInfo)
- {
- CAction *action = fButtonPart->GetAction();
- if (action)
- action->Externalize(ev, storage);
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonSelection::DoInternalizeSelection
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CButtonSelection::DoInternalizeSelection(
- Environment* ev,
- ODStorageUnit* storage,
- FW_CCloneInfo* cloneInfo)
- {
- FW_Boolean internalized = FALSE;
-
- CAction *action = NULL;
- if (CScriptAction::IsInStorage(ev, storage))
- action = new CScriptAction();
- else if (CSoundAction::IsInStorage(ev, storage))
- action = new CSoundAction();
-
- if (action != NULL)
- {
- action->Internalize(ev, storage);
- fButtonPart->SetAction(action);
- fButtonPart->Changed(ev);
- internalized = true;
- }
-
- return internalized;
- }
-